﻿<UserControl x:Class="Gao.Poker.App.Store.MarketView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d">
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="7*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="150"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>

        <TextBlock Text="会员卡号：" Margin="0,0,1,8" VerticalAlignment="Bottom" HorizontalAlignment="Right" FontSize="13" />
        <TextBox FontSize="13"  Grid.Row="0" Grid.Column="1" Text="{Binding Path=CardNo}" Margin="1" VerticalContentAlignment="Center" Width="300" HorizontalAlignment="Left" />
        <TextBlock FontSize="13"  Grid.Row="1" Grid.Column="0" Text="会员姓名：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBlock FontSize="13"  Grid.Row="1" Grid.Column="1" Text="{Binding Path=Member.Name}" Margin="1" VerticalAlignment="Center" />

        <TextBlock FontSize="13"  Grid.Row="2" Grid.Column="0" Text="会员积分：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBlock FontSize="13"  Grid.Row="2" Grid.Column="1" Text="{Binding Path=Member.Points}" Margin="1" VerticalAlignment="Center" />

        <TextBlock FontSize="13"  Grid.Row="3" Grid.Column="0" Text="商品编号：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBox FontSize="13"  Grid.Row="3" Grid.Column="1" Text="{Binding Path=BarCode}" Margin="1" VerticalContentAlignment="Center"  Width="300" HorizontalAlignment="Left"/>
        <!--<DataGrid   Grid.Row="4" Grid.Column="1"  Margin="1" RowHeight="30" Name="dgRight"  AutoGenerateColumns="False" 
                      SelectionMode="Single"  CanUserAddRows="True"
                      ItemsSource="{Binding Path=ConsumptionProducts}"
                      FontSize="16" Height="Auto" CellEditEnding="dgRight_CellEditEnding" LostFocus="dgRight_LostFocus">
            <DataGrid.Columns>
                <DataGridTextColumn Header="编码" Width="60" IsReadOnly="True"  Binding="{Binding Path=BarCode}"/>
                <DataGridTextColumn Header="商品名称" Width="*" IsReadOnly="True"  Binding="{Binding Path=ProductName}"/>
                <DataGridTextColumn Header="单价" Width="60" IsReadOnly="True"  Binding="{Binding Path=PPrice}"/>
                <DataGridTextColumn Header="库存" Width="60" IsReadOnly="True"  Binding="{Binding Path=PNumber}"/>
                <DataGridTextColumn Header="购买数量" Width="80"  Binding="{Binding Path=Number}"/>
                <DataGridTextColumn Header="折扣" Width="80"  Binding="{Binding Path=Discount}"/>
                <DataGridTextColumn Header="总计" Width="60"  Binding="{Binding Path=Total}"/>
            </DataGrid.Columns>
        </DataGrid>-->
        <ListView Grid.Row="4" Grid.Column="1"  Margin="1" SelectionMode="Single" IsSynchronizedWithCurrentItem="True"
                 ItemsSource="{Binding Path=ConsumptionProducts}">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Center" />
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="编码"  Width="60" DisplayMemberBinding="{Binding Path=BarCode}"/>
                    <GridViewColumn Header="商品名称" Width="auto" DisplayMemberBinding="{Binding Path=ProductName}"/>
                    <GridViewColumn Header="单价" Width="80" DisplayMemberBinding="{Binding Path=PIntegral}"/>
                    <GridViewColumn Header="库存" Width="80" DisplayMemberBinding="{Binding Path=PNumber}"/>
                    <GridViewColumn Header="购买数量" Width="90">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Path=Number}"  Width="80" Height="30" VerticalContentAlignment="Center" HorizontalContentAlignment="Right"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="折扣" Width="90">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Path=Discount}"  Width="80" Height="30" VerticalContentAlignment="Center" HorizontalContentAlignment="Right"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="总计" Width="100" DisplayMemberBinding="{Binding Path=Total}" TextBlock.TextAlignment="Right"/>
                </GridView>
            </ListView.View>
        </ListView>

        <TextBlock FontSize="13"  Grid.Row="5" Grid.Column="0" Text="积分总计：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBox FontSize="13"  Grid.Row="5" Grid.Column="1" Text="{Binding Path=Monetary}" Width="300" Margin="1" VerticalContentAlignment="Center"  HorizontalAlignment="Left" />

        <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2"  Grid.Row="8" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Button Padding="5" Style="{DynamicResource Orrange}" Width="60" FontSize="16" Height="35" Name="btnLogin" 
                    Click="Submit_Click">确认</Button>
        </StackPanel>
        <Button Content="查询" HorizontalAlignment="Left" Margin="319,0,0,2" Click ="MemberSearch_Click"  Style="{DynamicResource Orrange}" Width="60" Grid.Column="1" />
        <Button Content="查询" HorizontalAlignment="Left" Margin="319,0,0,2" Style="{DynamicResource Orrange}" Width="60" Grid.Column="1" Grid.Row="3"  Click ="ProductSearch_Click" />
        <Button Content="计算" HorizontalAlignment="Left" Margin="319,0,0,2" Style="{DynamicResource Orrange}" Width="60" Grid.Column="1" Grid.Row="5" Command="{Binding CalculateCommand}" />
    </Grid>
</UserControl>
